package com.woniu.woniuproject.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.woniuproject.entity.Product_account;
import com.woniu.woniuproject.mapper.Product_accountMapper;
import com.woniu.woniuproject.vo.Page;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * 功能描述:<br>
 * 〈〉
 *
 * @author EDZ
 * @create 2020/11/17
 * @since 1.0.0
 */
@Service
public class ProductAccountService {

    @Autowired
    Product_accountMapper product_accountMapper;
    Logger logger = LoggerFactory.getLogger(ProductAccountService.class);

    /*查询所有购买官标产品的用户集合*/

    public Map queryall(){
        HashMap<String, Object> map = new HashMap<>();
        List<Integer> list=new ArrayList<>();
        List<Double> list1=new ArrayList<>();
        list.add(product_accountMapper.queryone());
        list.add( product_accountMapper.querytwo());
        list.add( product_accountMapper.querythree());
        map.put("list",list);
        list1.add(product_accountMapper.queryonemoney());
        list1.add(product_accountMapper.querytwomoney());
        list1.add(product_accountMapper.querythreemoney());
        map.put("money",list1);
        return map;
    }

    public Map queryall1(){
        HashMap<String, Object> map = new HashMap<>();
        List<Integer> list=new ArrayList<>();
        List<Double> list1=new ArrayList<>();
        logger.info(product_accountMapper.queryone()+"================");
        System.out.println(product_accountMapper.queryone()+"================");
        list.add(product_accountMapper.queryone());
        map.put("list",list);
        return map;
    }


    public PageInfo<Product_account> queryByAplay(Date startDates, Date endDates, Page page) {
        PageHelper.startPage(page.getNowPage(),page.getMaxPage());
        List<Product_account> looseLabels = product_accountMapper.selectByAplay(startDates, endDates);
        PageInfo<Product_account> info = new PageInfo<>(looseLabels);
        return info;
    }

    public List<Product_account> queryByUid(Integer finvestrecordid) {
        return product_accountMapper.queryByUid(finvestrecordid);
    }

    public int insert(Product_account product_account) {
        return product_accountMapper.insert(product_account);
    }
}